<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ include file="/views/commons/taglibs.jsp" %>
<script src="<%=path %>/js/common.js"></script>
<div class="panel-heading">
	<h3 class="panel-title">交易列表</h3>
</div>
<div class="bd clearfix">
	<form id="admin_trade_choose_form" action="javascript:queryAdminTradeList(1);">
		<div class="filter-wrap">
			<dl class="clearfix invest-filter">
				<dt>项目名</dt>
				<dd class="clearfix">
					<ul class="col-sm-5"><input type="text" class="form-control" name="projectName" value="${paramMap.projectName}" placeholder="请输入项目名关键词"></ul>
				</dd>
			</dl>
			<dl class="clearfix invest-filter">
				<dt>问题详情</dt>
				<dd class="clearfix">
					<ul class="col-sm-5"><input type="text" class="form-control" name="questionDetail" value="${paramMap.questionDetail}" placeholder="请输入问题详情关键词"></ul>
				</dd>
			</dl>
			<d:radio describe="交易类型" tableColumn="trade_type" fieldName="tradeType" 
				value="${paramMap.tradeType}" type="query" queryFunction="queryAdminTradeList"></d:radio>
			<d:radio describe="交易状态" tableColumn="trade_state" fieldName="tradeState" 
				value="${paramMap.tradeState}" type="query" queryFunction="queryAdminTradeList"></d:radio>
			<dl class="clearfix invest-filter">
				<dt>购买人昵称</dt>
				<dd class="clearfix">
					<ul class="col-sm-5"><input type="text" class="form-control" name="buyUserName" value="${paramMap.buyUserName}" placeholder="请输入拆解查看人/提问人/偷看人昵称关键词"></ul>
				</dd>
			</dl>
		</div>
		<div class="text-center pb20">
			<button class="btn btn-primary">搜索</button>
		</div>
	</form>
</div>
<c:choose>
<c:when test="${!empty dataList && fn:length(dataList) ne 0}">
<table class="table">
	<thead>
		<tr>
			<th width="35%">项目名/问题详情</th>
			<th width="10%">交易类型</th>
			<th width="15%">交易状态</th>
			<th width="15%">购买人昵称</th>
			<th width="25%">操作</th>
		</tr>
	</thead>
	<tbody>
		<c:forEach var="trade" items="${dataList}" varStatus="index">
		<tr>
			<td class="title">
				<c:choose>
					<c:when test="${trade.tradeType==1}">	
					<a href="<%=path %>/admin/trade/toUpdate/${trade.tradeId}" target="_blank">${trade.projectName}：拆解项${trade.itemIndex}</a>
					</c:when>
					
					<c:when test="${trade.tradeType==2 || trade.tradeType==3}">	
					<a href="<%=path %>/admin/trade/toUpdate/${trade.tradeId}" target="_blank">${trade.questionDetail}</a>
					</c:when>
				</c:choose>	
				
			</td>
			<td>
				<c:choose>
					<c:when test="${trade.tradeType==1}">	
					拆解查看
					</c:when>
					
					<c:when test="${trade.tradeType==2}">	
					问题提问
					</c:when>
					
					<c:when test="${trade.tradeType==3}">	
					偷看
					</c:when>
				</c:choose>	
			</td>
			<td>
				<c:choose>
					<c:when test="${trade.tradeState==1}">	
					购买人付款
					</c:when>
					
					<c:when test="${trade.tradeState==2}">	
					拆解人或回答人收款
					</c:when>
				</c:choose>	
			</td>
			<td>${trade.buyUserName}</td>
			<td>
				<a href="javascript:deleteTradeById('${trade.tradeId}')">删除</a>
				<c:if test="${trade.tradeState==1}">	
				<a href="<%=path %>/admin/trade/paySaleUser/${trade.tradeId}" target="_blank">拆解人/回答人收款</a>
				</c:if>
			</td>
		</tr>
		</c:forEach>
	</tbody>
</table>
<!-- 分页 -->
<p:pagination pageNo="${paramMap.pageNo}" pageCount="${paramMap.pageCount}" queryFunction="queryAdminTradeList" style="text-center"></p:pagination>
<!-- 分页 end -->
</c:when>
<c:otherwise>
	<table class="table">
		<thead>
			<tr>
				<th width="35%">项目名/问题详情</th>
				<th width="10%">交易类型</th>
				<th width="15%">交易状态</th>
				<th width="15%">购买人昵称</th>
				<th width="25%">操作</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td colspan="5" align="center">
					暂无数据
				</td>
			</tr>
		</tbody>
	</table>
</c:otherwise>
</c:choose>